function QuizInitAssistant(args) {
	/*
	 * this is the creator function for your scene assistant object. It will be
	 * passed all the additional parameters (after the scene name) that were
	 * passed to pushScene. The reference to the scene controller
	 * (this.controller) has not be established yet, so any initialization that
	 * needs the scene controller should be done in the setup function below.
	 */
	this.gameValue = args;
}

QuizInitAssistant.prototype.setup = function() {
	/*
	 * this function is for setup tasks that have to happen when the scene is
	 * first created
	 */

	/*
	 * use Mojo.View.render to render view templates and add them to the scene,
	 * if needed
	 */

	/* setup widgets here */

	/* add event handlers to listen to events from widgets */
	//	
	// Set the default Values
	this.defaultCookie = new Mojo.Model.Cookie("Music-Quiz-Settings");
	// this.controller.stageController.setWindowOrientation('free');

	/*
	 * quizStats = { qSize : qNum, qTime : tNum, qSound : tSound, qClef :
	 * cCleff, qSharp : tSharp, showStaff : sCleff, nType : tNoteType, qAnswers : [] };
	 * 
	 */
	quizStats = this.defaultCookie.get();
	Mojo.Log.info("Got Cookie:" + quizStats);

	// Set Defaults
	qNumDefault = 5;
	tNumDefault = 10;
	tSoundDefault = 1;
	tSharpDefault = false;
	cClefDefault = 1;
	cNoteDefault = 1;
	rtNumDefault = 0;
	// Overwrite Defaults with cookie.
	if (quizStats) {
		Mojo.Log.info("found cookie");
		qNumDefault = quizStats.qSize;
		tNumDefault = quizStats.qTime;
		tSharpDefault = quizStats.qSharp;
		cClefDefault = quizStats.qClef;
		cNoteDefault = quizStats.nType;
		rtNumDefault = quizStats.rtNum;

		bSound = quizStats.qSound;
		bShowClef = quizStats.showStaff;

		if (bSound == true && bShowClef == true) {
			Mojo.Log.info("cNote = 1");
			tSoundDefault = 1;
		} else if (bSound == false && bShowClef == true) {
			Mojo.Log.info("cNote = 2");
			tSoundDefault = 2;
		} else {
			Mojo.Log.info("cNote = 3");
			tSoundDefault = 3;
		}

	}

	if (this.gameValue == "PracticeGame") {
		$('timerQuizRow').style.display = "none";
		$('timerRaceRow').style.display = "none";
	} else if (this.gameValue == "RaceGame") {
		$('questionQuizRow').style.display = "none";
		$('timerQuizRow').style.display = "none";
	} else if (this.gameValue == "QuizGame") {
		$('timerRaceRow').style.display = "none";
	}

	this.controller.setupWidget("qNum", this.attributes = {
		label : ' ',
		modelProperty : 'value',
		min : 1,
		max : 20
	}, this.qNumModel = {
		value : qNumDefault
	});

	this.controller.setupWidget("tNum", this.attributes = {
		label : ' ',
		modelProperty : 'value',
		min : 2,
		max : 20
	}, this.tNumModel = {
		value : tNumDefault
	});

	this.controller.setupWidget("rtNum", this.attributes = {
		choices : [ {
			label : "30s",
			value : 0
		}, {
			label : "1m",
			value : 1
		}, {
			label : "1m30s",
			value : 2
		}, {
			label : "2m",
			value : 3
		} ]
	}, this.rtNumModel = {
		value : rtNumDefault
	});

	this.controller.setupWidget("tSound", this.attributes = {
		choices : [ {
			label : "Clef w/Sound",
			value : 1
		}, {
			label : "Clef wo/Sound",
			value : 2
		}, {
			label : "Sound Only",
			value : 3
		},

		]
	}, this.tSoundModel = {
		value : tSoundDefault,
		disabled : false
	});

	this.controller.setupWidget("tSharp", this.attributes = {},
			this.tSharpModel = {
				value : tSharpDefault,
				disabled : false
			});

	this.controller.setupWidget("cCleff", this.attributes = {
		choices : [ {
			label : "Treble",
			value : 1
		}, {
			label : "Bass",
			value : 2
		}, {
			label : "Both",
			value : 3
		} ]
	}, this.cCleffModel = {
		value : cClefDefault,
		disabled : false
	});

	this.controller.setupWidget("noteType", this.attributes = {
		choices : [ {
			label : "Note w/Notation",
			value : 1
		}, {
			label : "Note",
			value : 2
		}, {
			label : "Solfege",
			value : 3
		} ]
	}, this.cNoteModel = {
		value : cNoteDefault,
		disabled : false
	});

	this.controller.setupWidget("bDone", this.attributes = {}, this.model = {
		label : "Start",
		disabled : false
	});
	
	//Back Widget
	if(myApp.isTouchPad()){

		 var menuModel = {

		             visible: true,
		             items: [ 
		                    { icon: "back", command: "goBack"}
		             ]
		         }; 

		     this.controller.setupWidget(Mojo.Menu.commandMenu,
		         this.attributes = {
		             spacerHeight: 0,
		             menuClass: 'no-fade'
		         },
		         menuModel
		     );   

		}

	Mojo.Event.listen(this.controller.get("bDone"), Mojo.Event.tap,
			this.handleButtonTap.bind(this));

};
QuizInitAssistant.prototype.handleButtonTap = function(event) {
	// Get Values
	qNum = this.qNumModel.value;
	tNum = this.tNumModel.value;
	cCleff = this.cCleffModel.value;
	tSharp = this.tSharpModel.value;
	tNoteType = this.cNoteModel.value;
	Mojo.Log.info("tSound:" + this.tSoundModel.value);

	if (this.tSoundModel.value == 1) {
		tSound = true;
		sCleff = true;
	} else if (this.tSoundModel.value == 2) {
		tSound = false;
		sCleff = true;
	} else {
		tSound = true;
		sCleff = false;
	}

	quizStats = {
		qMode : this.gameValue,
		qSize : qNum,
		qTime : tNum,
		rtNum : this.rtNumModel.value,
		qSound : tSound,
		qClef : cCleff,
		qSharp : tSharp,
		showStaff : sCleff,
		nType : tNoteType,
		qAnswers : []
	};

	this.defaultCookie.put(quizStats);
	if (this.gameValue == "PracticeGame")
		Mojo.Controller.stageController.pushScene("MainPractice", quizStats);
	else
		Mojo.Controller.stageController.pushScene("MainScene", quizStats);

};
QuizInitAssistant.prototype.activate = function(event) {
	/*
	 * put in event handlers here that should only be in effect when this scene
	 * is active. For example, key handlers that are observing the document
	 */
};

QuizInitAssistant.prototype.deactivate = function(event) {
	/*
	 * remove any event handlers you added in activate and do any other cleanup
	 * that should happen before this scene is popped or another scene is pushed
	 * on top
	 */
};

QuizInitAssistant.prototype.cleanup = function(event) {
	/*
	 * this function should do any cleanup needed before the scene is destroyed
	 * as a result of being popped off the scene stack
	 */
};
